package pl.edu.agh.jemo.evolution.objfunc;

import javax.swing.JPanel;

import pl.edu.agh.jemo.evolution.specimen.Specimen;

/**
 * Interface for objective function
 * It is root for all types of criteria that might be optimised using genetic algorithms
 * 
 * @author Marcin Zbijowski
 */
public interface ObjectiveFunction {
	
	/**
	 * Performs evaluation of given specimen from implemented criteria point of view.
	 * Calculations should be based on specimen Genotype and parameters stored in specific
	 * ObjectiveFunction instance.
	 * Specimen reference should not change while calculations.
	 * 
	 * @param specimen Specimen reference for which value is calculated.
	 * @return Calculated Double value derived from specimen genotype.
	 */
	public Double calculateValue(Specimen specimen);
	
	/**
	 * Returns instance of configuration panel allowing to configure function parameters.
	 * Returned JPanel instance should contain reference to object it was returned by. All changes on panel should affect that object.
	 * 
	 * @return Instance of JPanel, to configure function, or null if no configuration for function is available.
	 */
	public JPanel getConfigPanel();
	
	/**
	 * Returns max function value for graphing purposes.
	 * @return
	 */
	public Double getMaxValue();
	
	/**
	 * Returns min function value for graphing purposes.
	 * @return
	 */
	public Double getMinValue();
	
}
